"use strict";var me=Object.create;var _=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var Ae=Object.getPrototypeOf,Be=Object.prototype.hasOwnProperty;var he=(e,n)=>{for(var s in n)_(e,s,{get:n[s],enumerable:!0})},V=(e,n,s,T)=>{if(n&&typeof n=="object"||typeof n=="function")for(let d of Se(n))!Be.call(e,d)&&d!==s&&_(e,d,{get:()=>n[d],enumerable:!(T=xe(n,d))||T.enumerable});return e},w=(e,n,s)=>(V(e,n,"default"),s&&V(s,n,"default")),be=(e,n,s)=>(s=e!=null?me(Ae(e)):{},V(n||!e||!e.__esModule?_(s,"default",{value:e,enumerable:!0}):s,e)),ke=e=>V(_({},"__esModule",{value:!0}),e);var O={};he(O,{ApiProvider:()=>De,createApi:()=>Ue,reactHooksModule:()=>se,reactHooksModuleName:()=>ie});module.exports=ke(O);var Y=require("@reduxjs/toolkit/query");var $e=require("@reduxjs/toolkit");function ue(e){return e.type==="query"}function ae(e){return e.type==="mutation"}function q(e,...n){return Object.assign(e,...n)}function j(e){return e.replace(e[0],e[0].toUpperCase())}var a=require("@reduxjs/toolkit");var de=require("@reduxjs/toolkit"),Ie=require("@reduxjs/toolkit"),z=require("@reduxjs/toolkit/query"),t=require("react"),Z=require("react-redux");var ye=WeakMap?new WeakMap:void 0,pe=({endpointName:e,queryArgs:n})=>{let s="",T=ye?.get(n);if(typeof T=="string")s=T;else{let d=JSON.stringify(n,(S,g)=>(g=typeof g=="bigint"?{$bigint:g.toString()}:g,g=(0,a.isPlainObject)(g)?Object.keys(g).sort().reduce((b,k)=>(b[k]=g[k],b),{}):g,g));(0,a.isPlainObject)(n)&&ye?.set(n,d),s=d}return`${e}(${s})`};var W=Symbol();var L=require("react");function ne(e,n,s,T){let d=(0,L.useMemo)(()=>({queryArgs:e,serialized:typeof e=="object"?n({queryArgs:e,endpointDefinition:s,endpointName:T}):e}),[e,n,s,T]),S=(0,L.useRef)(d);return(0,L.useEffect)(()=>{S.current.serialized!==d.serialized&&(S.current=d)},[d]),S.current.serialized===d.serialized?S.current.queryArgs:e}var $=require("react"),re=require("react-redux");function G(e){let n=(0,$.useRef)(e);return(0,$.useEffect)(()=>{(0,re.shallowEqual)(n.current,e)||(n.current=e)},[e]),(0,re.shallowEqual)(n.current,e)?n.current:e}var Ee=typeof window<"u"&&window.document&&window.document.createElement?t.useLayoutEffect:t.useEffect,Me=e=>e.isUninitialized?{...e,isUninitialized:!1,isFetching:!0,isLoading:e.data===void 0,status:z.QueryStatus.pending}:e;function ce({api:e,moduleOptions:{batch:n,hooks:{useDispatch:s,useSelector:T,useStore:d},unstable__sideEffectsInRender:S,createSelector:g},serializeQueryArgs:b,context:k}){let F=S?r=>r():t.useEffect;return{buildQueryHooks:U,buildMutationHook:I,usePrefetch:ee};function X(r,y,f){if(y?.endpointName&&r.isUninitialized){let{endpointName:p}=y,m=k.endpointDefinitions[p];b({queryArgs:y.originalArgs,endpointDefinition:m,endpointName:p})===b({queryArgs:f,endpointDefinition:m,endpointName:p})&&(y=void 0)}let D=r.isSuccess?r.data:y?.data;D===void 0&&(D=r.data);let u=D!==void 0,o=r.isLoading,i=(!y||y.isLoading||y.isUninitialized)&&!u&&o,c=r.isSuccess||o&&u;return{...r,data:D,currentData:r.data,isFetching:o,isLoading:i,isSuccess:c}}function ee(r,y){let f=s(),D=G(y);return(0,t.useCallback)((u,o)=>f(e.util.prefetch(r,u,{...D,...o})),[r,f,D])}function U(r){let y=(u,{refetchOnReconnect:o,refetchOnFocus:i,refetchOnMountOrArgChange:c,skip:p=!1,pollingInterval:m=0,skipPollingIfUnfocused:l=!1}={})=>{let{initiate:E}=e.endpoints[r],Q=s(),R=(0,t.useRef)(void 0);if(!R.current){let M=Q(e.internalActions.internal_getRTKQSubscriptions());R.current=M}let B=ne(p?z.skipToken:u,pe,k.endpointDefinitions[r],r),x=G({refetchOnReconnect:o,refetchOnFocus:i,pollingInterval:m,skipPollingIfUnfocused:l}),h=(0,t.useRef)(!1),A=(0,t.useRef)(void 0),{queryCacheKey:N,requestId:C}=A.current||{},H=!1;N&&C&&(H=R.current.isRequestSubscribed(N,C));let v=!H&&h.current;return F(()=>{h.current=H}),F(()=>{v&&(A.current=void 0)},[v]),F(()=>{let M=A.current;if(typeof process<"u",B===z.skipToken){M?.unsubscribe(),A.current=void 0;return}let te=A.current?.subscriptionOptions;if(!M||M.arg!==B){M?.unsubscribe();let K=Q(E(B,{subscriptionOptions:x,forceRefetch:c}));A.current=K}else x!==te&&M.updateSubscriptionOptions(x)},[Q,E,c,B,x,v]),(0,t.useEffect)(()=>()=>{A.current?.unsubscribe(),A.current=void 0},[]),(0,t.useMemo)(()=>({refetch:()=>{if(!A.current)throw new Error((0,de.formatProdErrorMessage)(38));return A.current?.refetch()}}),[])},f=({refetchOnReconnect:u,refetchOnFocus:o,pollingInterval:i=0,skipPollingIfUnfocused:c=!1}={})=>{let{initiate:p}=e.endpoints[r],m=s(),[l,E]=(0,t.useState)(W),Q=(0,t.useRef)(void 0),R=G({refetchOnReconnect:u,refetchOnFocus:o,pollingInterval:i,skipPollingIfUnfocused:c});F(()=>{let h=Q.current?.subscriptionOptions;R!==h&&Q.current?.updateSubscriptionOptions(R)},[R]);let B=(0,t.useRef)(R);F(()=>{B.current=R},[R]);let x=(0,t.useCallback)(function(h,A=!1){let N;return n(()=>{Q.current?.unsubscribe(),Q.current=N=m(p(h,{subscriptionOptions:B.current,forceRefetch:!A})),E(h)}),N},[m,p]);return(0,t.useEffect)(()=>()=>{Q?.current?.unsubscribe()},[]),(0,t.useEffect)(()=>{l!==W&&!Q.current&&x(l,!0)},[l,x]),(0,t.useMemo)(()=>[x,l],[x,l])},D=(u,{skip:o=!1,selectFromResult:i}={})=>{let{select:c}=e.endpoints[r],p=ne(o?z.skipToken:u,b,k.endpointDefinitions[r],r),m=(0,t.useRef)(void 0),l=(0,t.useMemo)(()=>g([c(p),(x,h)=>h,x=>p],X,{memoizeOptions:{resultEqualityCheck:Z.shallowEqual}}),[c,p]),E=(0,t.useMemo)(()=>i?g([l],i,{devModeChecks:{identityFunctionCheck:"never"}}):l,[l,i]),Q=T(x=>E(x,m.current),Z.shallowEqual),R=d(),B=l(R.getState(),m.current);return Ee(()=>{m.current=B},[B]),Q};return{useQueryState:D,useQuerySubscription:y,useLazyQuerySubscription:f,useLazyQuery(u){let[o,i]=f(u),c=D(i,{...u,skip:i===W}),p=(0,t.useMemo)(()=>({lastArg:i}),[i]);return(0,t.useMemo)(()=>[o,c,p],[o,c,p])},useQuery(u,o){let i=y(u,o),c=D(u,{selectFromResult:u===z.skipToken||o?.skip?void 0:Me,...o}),{data:p,status:m,isLoading:l,isSuccess:E,isError:Q,error:R}=c;return(0,t.useDebugValue)({data:p,status:m,isLoading:l,isSuccess:E,isError:Q,error:R}),(0,t.useMemo)(()=>({...c,...i}),[c,i])}}}function I(r){return({selectFromResult:y,fixedCacheKey:f}={})=>{let{select:D,initiate:u}=e.endpoints[r],o=s(),[i,c]=(0,t.useState)();(0,t.useEffect)(()=>()=>{i?.arg.fixedCacheKey||i?.reset()},[i]);let p=(0,t.useCallback)(function(te){let K=o(u(te,{fixedCacheKey:f}));return c(K),K},[o,u,f]),{requestId:m}=i||{},l=(0,t.useMemo)(()=>D({fixedCacheKey:f,requestId:i?.requestId}),[f,i,D]),E=(0,t.useMemo)(()=>y?g([l],y):l,[y,l]),Q=T(E,Z.shallowEqual),R=f==null?i?.arg.originalArgs:void 0,B=(0,t.useCallback)(()=>{n(()=>{i&&c(void 0),f&&o(e.internalActions.removeMutationResult({requestId:m,fixedCacheKey:f}))})},[o,f,i,m]),{endpointName:x,data:h,status:A,isLoading:N,isSuccess:C,isError:H,error:v}=Q;(0,t.useDebugValue)({endpointName:x,data:h,status:A,isLoading:N,isSuccess:C,isError:H,error:v});let M=(0,t.useMemo)(()=>({...Q,originalArgs:R,reset:B}),[Q,R,B]);return(0,t.useMemo)(()=>[p,M],[p,M])}}}var P=require("react-redux"),fe=require("reselect");var ie=Symbol(),se=({batch:e=P.batch,hooks:n={useDispatch:P.useDispatch,useSelector:P.useSelector,useStore:P.useStore},createSelector:s=fe.createSelector,unstable__sideEffectsInRender:T=!1,...d}={})=>({name:ie,init(S,{serializeQueryArgs:g},b){let k=S,{buildQueryHooks:F,buildMutationHook:X,usePrefetch:ee}=ce({api:S,moduleOptions:{batch:e,hooks:n,unstable__sideEffectsInRender:T,createSelector:s},serializeQueryArgs:g,context:b});return q(k,{usePrefetch:ee}),q(b,{batch:e}),{injectEndpoint(U,I){if(ue(I)){let{useQuery:r,useLazyQuery:y,useLazyQuerySubscription:f,useQueryState:D,useQuerySubscription:u}=F(U);q(k.endpoints[U],{useQuery:r,useLazyQuery:y,useLazyQuerySubscription:f,useQueryState:D,useQuerySubscription:u}),S[`use${j(U)}Query`]=r,S[`useLazy${j(U)}Query`]=y}else if(ae(I)){let r=X(U);q(k.endpoints[U],{useMutation:r}),S[`use${j(U)}Mutation`]=r}}}}});w(O,require("@reduxjs/toolkit/query"),module.exports);var le=require("@reduxjs/toolkit"),Qe=require("@reduxjs/toolkit"),Te=require("react"),ge=require("react"),oe=be(require("react")),J=require("react-redux"),Re=require("@reduxjs/toolkit/query");function De(e){let n=e.context||J.ReactReduxContext;if((0,Te.useContext)(n))throw new Error((0,le.formatProdErrorMessage)(35));let[T]=oe.default.useState(()=>(0,Qe.configureStore)({reducer:{[e.api.reducerPath]:e.api.reducer},middleware:d=>d().concat(e.api.middleware)}));return(0,ge.useEffect)(()=>e.setupListeners===!1?void 0:(0,Re.setupListeners)(T.dispatch,e.setupListeners),[e.setupListeners,T.dispatch]),oe.default.createElement(J.Provider,{store:T,context:n},e.children)}var Ue=(0,Y.buildCreateApi)((0,Y.coreModule)(),se());
//# sourceMappingURL=rtk-query-react.production.min.cjs.map